<?php
include_once '../connexpdo.php';
$client = $_POST ['idClientEnvoiAjax'];
$query = 'SELECT * FROM appels as a INNER JOIN problematique As p ON a.idproblematique = p.id INNER JOIN cloturer AS c ON a.idcloturer = c.id INNER JOIN praticiens AS pr ON pr.id = a.idclient';
$return = $connexion->query ( $query );
$vretour = array ();

while ( $row = $return->fetch () ) {
	
	$data [] = array (
			"id" => $row ['idAppels'],
			"commentaire" => utf8_array ( addslashes ( $row ['commentaires'] ) ),
			"Client" => utf8_array ( $row ['nom'] ) . ' ' . utf8_array ( $row ['prenom'] ),
			"nature" => utf8_array ( $row ['nature'] ),
			"date" => utf8_array ( $row ['dateDebut'] ),
			"duree" => utf8_array ( $row ['duree'] ),
			"reponse" => utf8_array ( $row ['reponse'] ) 
	);
	array_push ( $vretour, $data );
}
echo json_encode ( $data );
function utf8_array($data) {
	return utf8_encode ( $data );
}
?>